<template>
	<view class="container">
		<uni-section title="个人订单" type="line">
			<uni-card v-for="item in list" :key='item.id' :title='item.name' :sub-title='item.ads' :extra='item.sum'
				:thumbnail="item.avatar" @click="onClick(item)">
				<view>
					<text v-if="item.status == '正常'">营业时间:24小时营业</text>
					<text v-else>该店铺休业整改</text>
				</view>
				<view class="uni-body">
					<image class="img" src="../../static/shop/cdg.png"></image>
					<text>可用 .... </text>
					<text v-if="item.sum < 30">可还</text>
					<text v-else>不可还</text>
				</view>
			</uni-card>
		</uni-section>
	</view>
</template>

<script>
	import {
		userpmbyid
	} from '../../api/user.js';
	import {
		getToken
	} from '../../utils/auth.js';
	export default {
		components: {},
		data() {
			return {
				list: null
			}
		},
		onLoad() {
			let data = {
				id: getToken(),
			}
			userpmbyid(data).then(res => {
				if (res.data.code == 0) {
					this.list = res.data.data;
					console.log(this.list)
				}
			})
		},
		methods: {
			onClick(e) {
				// console.log(e);
				uni.navigateTo({
					url: '../shop/shopshow?&id=' + e.id
				})
			}
		}
	}
</script>

<style>
	.img {
		position: relative;
		width: 40rpx;
		height: 40rpx;
		top: 8rpx;
	}
</style>